{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li>
			<a href="{php echo $this->createWebUrl('datimanage',array('rid'=>$rid));}">答题管理</a>
		</li>
		<li class="active">
			{if $id!=0 && !empty($id)}<a href="{php echo $this->createWebUrl('adddati');}">编辑答题</a>{/if}
			{if $id==0 || empty($id)}<a href="{php echo $this->createWebUrl('adddati');}">添加答题</a>{/if}
		</li>
		<li>
			<a href="{php echo $this->createWebUrl('importdati');}">导入题库</a>
		</li>
	</ul>
<?php 
	$points=$question["points"];//分值
	$ques=$question["question"];//问题
	$quesimage=$question["quesimage"];//图案
	$type=$question["type"];//类型
	$realanswer=$question["realanswer"];//正确答案
	$answerA=$question["answerA"];//答案A
	$answerB=$question["answerB"];//答案B
	$answerC=$question["answerC"];//答案C
	$is_must=$question["is_must"]
?>

<!-- 
$answerD=$question["answerD"];//答案D
 -->

<div class="panel panel-default">
	<div class="panel-body">
    <form enctype="multipart/form-data" action="{php echo $this->createWebUrl('editdati');}"  method="post">
    	<input type="hidden" name="id" value="{$id}" />
		<input type="hidden" name="rid" value="{$rid}" />
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2  control-label"><span style='color: red'>*</span>类型</label>
			<div class="col-sm-10">
				<label class="radio-inline"> 
					<input type="radio" name="type" value="1" {if $type ==1} checked="checked" {/if}/>单选
				</label> 
				<!-- 
				<label class="radio-inline"> 
					<input type="radio" name="type" value="2" {if $type ==2} checked="checked" {/if}/>多选
				</label>
				 -->
				
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2  control-label"><span style='color: red'>*</span>是否必答</label>
			<div class="col-sm-10">
		    	<label class="radio-inline"> 
					<input type="radio" name="is_must" value="0" {if $is_must ==0} checked="checked" {/if}/>否
				</label> 
				<label class="radio-inline"> 
					<input type="radio" name="is_must" value="1" {if $is_must ==1} checked="checked" {/if}/>是
				</label> 
				
				
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-xs-12 control-label"><span style='color: red'>*</span>问题</label>
			<input type="text" class="form-control" name="question" value="{$ques}" />
		</div>
		<!-- 
			<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2  control-label"><span style='color:red'>*</span>图案</label>
			<div class="col-sm-10">
				{php echo tpl_form_field_image('quesimage', $quesimage)}
				<span style="color:red;">图片大小：340*242</span>
			</div>		
		</div>
		 -->
	
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color: red'>*</span>答案</label>
			<div class="col-sm-10 col-xs-12">
				<div class="col-sm-10">
					<label class="col-xs-12 col-sm-2 col-md-1">A</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="answerA" value="{$answerA}" />
					</div>
				</div>
				<div class="col-sm-10">
					<label class="col-xs-12 col-sm-2 col-md-1">B</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="answerB" value="{$answerB}" />
					</div>
				</div>
				<div class="col-sm-10">
					<label class="col-xs-12 col-sm-2 col-md-1">C</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="answerC" value="{$answerC}" />
					</div>
				</div>
				<!-- 
				
				<div class="col-sm-10">
					<label class="col-xs-12 col-sm-2 col-md-1">D</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="answerD" value="{$answerD}" />
					</div>
				</div>
				 -->
				
			</div>
		</div>
		
		<div class="form-group" id="radioform">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
				style='color: red'>*</span>正确答案</label>
			<div class="col-sm-9 col-xs-12">
				<label class="radio-inline"> 
					<input type="radio" name="realans" value="A" {if $realanswer == 'A'} checked="checked" {/if}/>A
				</label> 
				<label class="radio-inline"> 
					<input type="radio" name="realans" value="B" {if $realanswer == 'B'} checked="checked" {/if}/>B
				</label> 
				<label class="radio-inline"> 
					<input type="radio" name="realans" value="C" {if $realanswer == 'C'} checked="checked" {/if}/>C
				</label> 
				<!-- 
				
				<label class="radio-inline"> 
					<input type="radio" name="realans" value="D" {if $realanswer == 'D'} checked="checked" {/if}/>D
				</label>
				 -->
				
			</div>
		</div>
		
		<div class="form-group" id="chkboxform" style="display:none;">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
				style='color: red'>*</span>正确答案</label>
			<div class="col-sm-9 col-xs-12">
				<label class="radio-inline">
					<input type="checkbox" name="realanswer[]" value="A" {if strpos($realanswer,'A') !== false} checked="checked" {/if}/>A
				</label> 
				<label class="radio-inline"> 
					<input type="checkbox" name="realanswer[]" value="B" {if strpos($realanswer,'B') !== false} checked="checked" {/if}/>B
				</label> 
				<label class="radio-inline"> 
					<input type="checkbox" name="realanswer[]" value="C" {if strpos($realanswer,'C') !== false} checked="checked" {/if}/>C
				</label> 
				<label class="radio-inline"> 
					<input type="checkbox" name="realanswer[]" value="D" {if strpos($realanswer,'D') !== false} checked="checked" {/if}/>D
				</label>
			</div>
		</div>
		
		<div class="form-group">
			<div class="col-sm-12">
				<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
			</div>
		</div>
		</form>
	</div>
</div>	

</div>
<script type="text/javascript">
$(function(){
	var type='{$type}';
	if(type==2){
		$("#radioform").hide();
		$("#chkboxform").show();
	}
});
$("input[name='type']").click(function(){
	if($(this).val()==1){
		$("#radioform").show();
		$("#chkboxform").hide();
	}else if($(this).val()==2){
		$("#radioform").hide();
		$("#chkboxform").show();
	}
})	
</script>
{template 'common/footer'}